[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Conditional Compilation Directives
Conditional Symbols
The use of conditional compilation directives will enable you to
compile different segments of your source code based on Conditional
Symbols. There are four standard symbols in Turbo Pascal; they are:
VER55 Defined by the Turbo Pascal based on the version
number of the compiler in use. Origniating with
version 4.0 and defined as VER40 and so forth.
MSDOS Inidicates the operating system. Other versions of
Turbo Pascal for another O/S will have a symbolic
name for that operating system.
CPU86 Indicates the CPU belongs to the 80x86 family. Other
versions of Turbo Pascal for another CPU family will
have a symbolic name for that CPU family.
CPU87 Defined at compile time only if an 80x87 is found.
Conditional symbols follow the same rules as identifiers. Their name
must start with a letter and can be of any length, but only the first
63 characters are significant.
Conditional symbols act similar to boolean varaiables. They are
either defined (True) or undefined (False).
Conditional Directives
The conditional directives control compilation of segments of your
source code. This enables you to produce different code using the
same program source. The conditional directives are:
{$DEFINE name} Defines a conditional symbol with the given name
{$UNDEF name} Undefines a conditional symbol with the given name
{$IFDEF name} Compile following source if symbol is defined
{$IFNDEF name} Compile following source if symbol is not defined
{$IFOPT switch} Compile following source if switch is is in the
specified state
{$ELSE} Switches between compiling/ignoring source contained
within the {$IFxxx} and the next {$ENDIF} directives
{$ENDIF} Terminates the conditional compile started by the
last {$IFxxx} directive
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson